/*
 * @Author: 米亚流年 miyaliunian@gmail.com
 * @Date: 2023-12-30 22:35:09
 * @LastEditors: 米亚流年 miyaliunian@gmail.com
 * @LastEditTime: 2024-03-02 14:12:35
 * @Description: transform vue src
 */
import demoLoader from './loader/demo-loader'
import docLoader from './loader/doc-loader'
import vueDocLoader from './loader/vue-doc-loader'

const transformedVueSrc = async (code, path) => {
  if (path.endsWith('.demo.md') || path.endsWith('.demo.vue')) {
    const type = path.endsWith('.vue') ? 'vue' : 'md'
    return demoLoader(code, path, type)
  }
  if (path.endsWith('.vue_doc.md')) {
    return vueDocLoader(code, path)
  }
  if (path.endsWith('.md')) {
    return docLoader(code, path)
  }
}

export default transformedVueSrc
